@include('common.header')


<div class="row" style="width:100%;margin-top:5%;" >
	<div class="col-md-6" style="text-align:center;" >
		<!-- 页面标记  -->
		<div style="margin:20px;margin-left:-25px;color:green;font-size:22px;">
		@if( isset($user_info) )
			编辑 VIP {{ $user_info->phone }}
		@else
			添加 VIP
		@endif
		</div>
		
	</div>
	<div class="col-md-6">
	</div>
</div>


<div class="row" style="width:100%;margin:0 auto;margin-top:2%;" >
	<div class="col-md-2">
	</div>
	<div class="col-md-10">
		<!-- 手机号 -->
		<div  class="form-group">
			<label class="col-sm-2 control-label">手机号</label>
			<div class="col-sm-10">
				<input style="width:430px;" type="text" name="phone" value="{{ $user_info->phone or '' }}" class="form-control phone"  placeholder="手机号" />
			</div>
		</div>
		<br/><br/><br/>
		
		<div style="overflow:hidden;width:450px;">
   
			<button  style="width:200px;float:left;" class="btn btn-danger">保存</button>
			<div style="margin-left:50px;float:left;margin-bottom:200px;">
				<a href="javascript:" onclick="self.location=document.referrer;"  style="width:200px;" class="btn btn-success">
				返回
				</a>
			</div>
			
		</div>
	</div>
</div>


<script type="text/javascript">
	
	//点击添加
	$(".btn-danger").click(function()
	{
		var phone = $(".phone").val();
		$.ajax({
			 type: "post",
			 url: "{{ url('/userAdd') }}",
			 data: {
				phone: phone,
				user_id:"{{ $user_info->id or '' }}",
				_token: _token
			},
			async: false,
			dataType: "json",
			success: function (back) 
			{
				if( back['show_info'].indexOf("成功") > 0 )
				{
					$(".btn-danger").attr('disabled',true);
				}
				$(".opa").html(back['show_info']);
				$(".opa").slideDown(1000);
				$(".opa").delay(1500).slideUp(1000);
			}
		})
	})

</script>


@extends('common.footer')